Here, we prepare IMC composites to find excatly these regions on the mIF images.

Read data and libraries

We will first load the needed libraries and data.

library(cytomapper)

all_images <- loadImages("/Volumes/immucan_volume/processed_data/Panel_1/2022_WORKFLOW/IMC/img/")
panel <- read.csv("/Volumes/immucan_volume/processed_data/Panel_1/2022_WORKFLOW/IMC/panel.csv")
channelNames(all_images) <- panel$name

Create composite images

all_images <- normalize(all_images, inputRange = list(Ecad = c(0,50), CD163 = c(0,5), CD45RA = c(0,10), CD45RO = c(0,50), DNA1 = c(0,100)))

out <- plotPixels(all_images,
           colour_by = c("CD163", "Ecad", "CD45RA", "CD45RO", "DNA1"),
           colour = list(CD163 = c("black", "red"),
                         Ecad = c("black", "green"),
                         CD45RA = c("black", "yellow"),
                         CD45RO = c("black", "yellow"),
                         DNA1 = c("black", "blue")),
           scale_bar = NULL,
           image_title = NULL,
           return_images = TRUE)

lapply(names(out$images), function(x){
    cur_image <- out$images[[x]]
    writeImage(rotate(cur_image, angle = 180), paste0("~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/", x, ".tiff"))
})
## [[1]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10034294-GI-VAR-TIS-UNST-03_001.tiff"
## 
## [[2]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10034294-GI-VAR-TIS-UNST-03_002.tiff"
## 
## [[3]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10034294-GI-VAR-TIS-UNST-03_003.tiff"
## 
## [[4]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10034294-GI-VAR-TIS-UNST-03_004.tiff"
## 
## [[5]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10061074-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[6]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10061074-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[7]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10061074-SPECT-VAR-TIS-01-IMC-01_003.tiff"
## 
## [[8]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10061074-SPECT-VAR-TIS-01-IMC-01_004.tiff"
## 
## [[9]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10063152-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[10]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10063152-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[11]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10063152-SPECT-VAR-TIS-01-IMC-01_003.tiff"
## 
## [[12]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10063152-SPECT-VAR-TIS-01-IMC-01_004.tiff"
## 
## [[13]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10067433-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[14]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10067433-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[15]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10067433-SPECT-VAR-TIS-01-IMC-01_003.tiff"
## 
## [[16]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10067433-SPECT-VAR-TIS-01-IMC-01_004.tiff"
## 
## [[17]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10068868-SPECT-VAR-TIS-01-IMC-01_005.tiff"
## 
## [[18]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10068868-SPECT-VAR-TIS-01-IMC-01_006.tiff"
## 
## [[19]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10068868-SPECT-VAR-TIS-01-IMC-01_007.tiff"
## 
## [[20]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10068868-SPECT-VAR-TIS-01-IMC-01_008.tiff"
## 
## [[21]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10071582-SPECT-VAR-TIS-01-IMC-01_005.tiff"
## 
## [[22]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10071582-SPECT-VAR-TIS-01-IMC-01_006.tiff"
## 
## [[23]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10071582-SPECT-VAR-TIS-01-IMC-01_007.tiff"
## 
## [[24]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10071582-SPECT-VAR-TIS-01-IMC-01_008.tiff"
## 
## [[25]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10073140-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[26]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10073140-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[27]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10073140-SPECT-VAR-TIS-01-IMC-01_003.tiff"
## 
## [[28]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10073140-SPECT-VAR-TIS-01-IMC-01_004.tiff"
## 
## [[29]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074349-SPECT-VAR-TIS-UNST-03_001.tiff"
## 
## [[30]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074349-SPECT-VAR-TIS-UNST-03_002.tiff"
## 
## [[31]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074349-SPECT-VAR-TIS-UNST-03_003.tiff"
## 
## [[32]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074349-SPECT-VAR-TIS-UNST-03_004.tiff"
## 
## [[33]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074832-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[34]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074832-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[35]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074832-SPECT-VAR-TIS-01-IMC-01_003.tiff"
## 
## [[36]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10074832-SPECT-VAR-TIS-01-IMC-01_004.tiff"
## 
## [[37]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10075371-SPECT-VAR-TIS-01-IMC-01_001.tiff"
## 
## [[38]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10075371-SPECT-VAR-TIS-01-IMC-01_002.tiff"
## 
## [[39]]
## [1] "~/SIB Swiss Institute of Bioinformatics/Robin Liechti - Workflow2021/Zurich_data/IMC_composites/IMMUcan_2022_WFLOW_10075371-SPECT-VAR-TIS-01-IMC-01_003.tiff"
sessionInfo()
## R version 4.2.0 (2022-04-22)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Catalina 10.15.7
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] cytomapper_1.8.0            SingleCellExperiment_1.18.0
##  [3] SummarizedExperiment_1.26.1 Biobase_2.56.0             
##  [5] GenomicRanges_1.48.0        GenomeInfoDb_1.32.1        
##  [7] IRanges_2.30.0              S4Vectors_0.34.0           
##  [9] BiocGenerics_0.42.0         MatrixGenerics_1.8.0       
## [11] matrixStats_0.62.0          EBImage_4.38.0             
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7           RColorBrewer_1.1-3     tools_4.2.0           
##  [4] bslib_0.3.1            utf8_1.2.2             R6_2.5.1              
##  [7] svgPanZoom_0.3.4       HDF5Array_1.24.0       vipor_0.4.5           
## [10] DBI_1.1.2              colorspace_2.0-3       rhdf5filters_1.8.0    
## [13] raster_3.5-15          sp_1.4-7               gridExtra_2.3         
## [16] tidyselect_1.1.2       compiler_4.2.0         cli_3.3.0             
## [19] DelayedArray_0.22.0    sass_0.4.1             scales_1.2.0          
## [22] nnls_1.4               systemfonts_1.0.4      stringr_1.4.0         
## [25] digest_0.6.29          tiff_0.1-11            fftwtools_0.9-11      
## [28] svglite_2.1.0          rmarkdown_2.14         XVector_0.36.0        
## [31] jpeg_0.1-9             pkgconfig_2.0.3        htmltools_0.5.2       
## [34] highr_0.9              fastmap_1.1.0          htmlwidgets_1.5.4     
## [37] rlang_1.0.2            rstudioapi_0.13        shiny_1.7.1           
## [40] jquerylib_0.1.4        generics_0.1.2         jsonlite_1.8.0        
## [43] BiocParallel_1.30.0    dplyr_1.0.9            RCurl_1.98-1.6        
## [46] magrittr_2.0.3         GenomeInfoDbData_1.2.8 Matrix_1.4-1          
## [49] Rcpp_1.0.8.3           ggbeeswarm_0.6.0       munsell_0.5.0         
## [52] Rhdf5lib_1.18.0        fansi_1.0.3            viridis_0.6.2         
## [55] abind_1.4-5            lifecycle_1.0.1        terra_1.5-21          
## [58] stringi_1.7.6          yaml_2.3.5             zlibbioc_1.42.0       
## [61] rhdf5_2.40.0           grid_4.2.0             parallel_4.2.0        
## [64] promises_1.2.0.1       shinydashboard_0.7.2   crayon_1.5.1          
## [67] lattice_0.20-45        locfit_1.5-9.5         knitr_1.39            
## [70] pillar_1.7.0           codetools_0.2-18       glue_1.6.2            
## [73] evaluate_0.15          png_0.1-7              vctrs_0.4.1           
## [76] httpuv_1.6.5           gtable_0.3.0           purrr_0.3.4           
## [79] assertthat_0.2.1       ggplot2_3.3.6          xfun_0.31             
## [82] mime_0.12              xtable_1.8-4           later_1.3.0           
## [85] viridisLite_0.4.0      tibble_3.1.7           beeswarm_0.4.0        
## [88] ellipsis_0.3.2